package com.itmg.analyze.jp.bean;

import com.itmg.analyze.jp.model.AmazonSearchParamModel;
import com.itmg.util.Constants;
import com.itmg.vo.SearchParameterVO;
/**
 * 
 * @author Yunhong Chen
 *
 */
public class AmazonParaBean {

	public AmazonParaBean() {
		
	}

	public static AmazonSearchParamModel getAmazonSearchParamModel(SearchParameterVO searchParameterVO) throws Exception
	{
		AmazonSearchParamModel amazonSearchParamModel = new AmazonSearchParamModel();
		String keywords = searchParameterVO.getKeyword();
		amazonSearchParamModel.setKeywords(keywords);
		
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PRICE_DOWN_TO_UP))
		{
			amazonSearchParamModel.setSort("-price");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PRICE_UP_TO_DOWN));
		{
			amazonSearchParamModel.setSort("price");
		}
//		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PV_RANK_DOWN_TO_UP))
//		{
//			amazonSearchParamModel.setSort("%2sold");
//		}
//		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PV_RANK_UP_TO_DOWN))
//		{
//			amazonSearchParamModel.setSort("-sold");
//		}
//		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_AFFLIATE_RATE_DOWN_TO_UP))
//		{
//			amazonSearchParamModel.setSort("%2affiliate");
//		}
//		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_AFFLIATE_RATE_UP_TO_DOWN))
//		{
//			amazonSearchParamModel.setSort("-affiliate");
//		}
		return amazonSearchParamModel;
	}
}
